<div class="box2">
    <h2>手机借还历史</h2>
    <a href="?c=mobileBorrow&a=create" class="add">手机借还</a>
    <table cellspacing="0">
        <tr>
            <th>编号</th>
            <th>手机型号</th>
            <th>自定义唯一码</th>
            <th>手机唯一码</th>
            <th>操作系统</th>
            <th>状态</th>
            <th>借用人</th>
            <th>借用时间</th>
            <th>应归还日期</th>
            <th>实际归还日期</th>
        </tr>

        <?php foreach ($data as $key => $item) { ?>
            <tr>
                <td><?= $item['id'] ?></td>
                <td><?= $item['models'] ?></td>
                <td><?= $item['unique_number'] ?></td>
                <td><?= $item['mobile_unique_number'] ?></td>
                <td><?= \app\models\Mobile::os($item['os']) ?></td>
                <td><?= \app\models\MobileBorrow::status($item['status']) ?>
                    <?php if ($item['status'] == 0) { ?>
                        <?php if (strtotime($item['should_return_time'] . ' 23:59:59') < time()) { ?>
                            <span class="red">(已逾期)</span>
                        <?php } else { ?>
                            <span>(正常)</span>
                        <?php } ?>
                    <?php } else if ($item['status'] == 1) { ?>
                        <?php if (strtotime($item['should_return_time']) < strtotime($item['actual_return_time'])) { ?>
                            <span class="red">(已逾期)</span>
                        <?php } else { ?>
                            <span>(正常)</span>
                        <?php } ?>
                    <?php } ?>
                </td>
                <td><?= $item['borrow_user'] ?></td>
                <td><?= $item['borrow_time'] ?></td>
                <td><?= $item['should_return_time'] ?></td>
                <td><?= $item['actual_return_time'] != '0000-00-00' ? $item['actual_return_time'] : '' ?></td>
            </tr>
        <?php } ?>
    </table>
    <?= $pagination->render() ?>
</div>